package com.example.sneakerappforme1105.bean;

import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;

@Entity(tableName = "tb_cart",
    foreignKeys = {
        @ForeignKey(
                entity = User.class,
                parentColumns = "userId",
                childColumns = "userId",
                onDelete = ForeignKey.CASCADE
        )
    }
)

public class Cart {
    @PrimaryKey(autoGenerate = true) // 该字段是自增主键
    @NonNull
    private long cartId; // 购物车序号
    private long userId; // 用户Id, 外键！！！！ 一对一
//    private String updateTime; // 更新时间

    public Cart(long userId, long cartId){
        this.userId = userId;
    }

//    public Cart(long cartId){
//        this.cartId =cartId;
//    }



    public long getCartId() {
        return cartId;
    }

    public void setCartId(long cartId) {
        this.cartId = cartId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

//    public String getUpdateTime() {
//        return updateTime;
//    }
//
//    public void setUpdateTime(String updateTime) {
//        this.updateTime = updateTime;
//    }
}
